/// Main models

//baseline * mediasystems
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban C_yyyy orgage mobfreq6 
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban C_yyyy orgage mobfreq6 , or

//baseline * mediasystems
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6 
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6 , or

////baseline * coutnry dummies
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban ib4.cntry C_yyyy orgage mobfreq6 
logit mediahit1 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban ib4.cntry C_yyyy orgage mobfreq6 , or

//initiators model 
logit mediahit1 actortype MP electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6 
logit mediahit1 actortype MP electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6, or

//PROTEST model 
logit mediahit1 actortype MP immigration europe economy lawandorder civilrights i.size i.repertoire3 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6
logit mediahit1 actortype MP immigration europe economy lawandorder civilrights i.size i.repertoire3 electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6, or


//full
logit mediahit1 actortype MP immigration europe economy lawandorder civilrights i.size i.repertoire3 i.ctrmob electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6

logit mediahit1 actortype MP immigration europe economy lawandorder civilrights i.size i.repertoire3 i.ctrmob electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6, or


//COEFPLOT 
logit mediahit1 actortype MP immigration europe economy lawandorder civilrights i.size i.repertoire3 i.ctrmob electionyear voterrpp pos_consensus miginflow refugees migmip dos_ban i.mediasyst C_yyyy orgage mobfreq6, or
estimates store fullmod

coefplot (fullmod, drop(_cons orgage C_yyyy mobfreq6) pstyle(p1line) msym(O) msize(small) mcol(black) eform xline(1, lcolor(gs8))),  headings(actortype="{bf:Group characteristics}" immigration = "{bf:Issue Focus}" 2.size="{bf:Protest scale}" 2.repertoire3="{bf:Tactics}" 1.ctrmob="{bf:Counter-protest}" electionyear= "{bf:Political Opportunities}" miginflow= "{bf:Discursive Opportunities}" 2.mediasyst="{bf:Media system}") coeflabels(MP="Groups with MPs" actortype="Social movement org." immigration="Immigration" europe="EU" economy="Economy and Welfare" lawandorder="Law & Order" civilrights="Civil Rights"scope="National level" 2.repertoire3="Moderately contentious" 3.repertoire3="Highly contentious" 1.ctrmob="Street counter-mobilization" electionyear= "Electoral year" voterrpp="Share of votes for RRPPs" pos_consensus="Institutional access points" miginflow="Annual inflow of migrants" refugees="Annual inflow of refugees" migmip="MIP: Immigration" dos_ban="Ban on far-right actors"4.mediasyst="CEE model", labsize(vsmall))  xtitle("Odds ratios") xlabel(,labsize(small)) levels(95 5 1) cismooth(color(gs15)) 
legend(label("Full Model") rows(2))

Robustness checks

//* SPECIFICATION ERROR */
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE, nolog
linktest, nolog 

//* GOODNESS OF FIT
collin MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 actortype immigration europe lawandorder civilrights economy scope repertoire3 ctrmob NSWE mediasys

//* INFLUENTIAL OBSERVATIONS
//1// Pearson residuals 
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob NSWE mediasys
predict p
predict stdres, rstand
scatter stdres p, mlab(id) ylab(-4(2) 16) yline(0)
gen id1=_n
/*scatter stdres id1, mlab(id) ylab(-4(2) 16) yline(0)*/

//2// Deviance residuals
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob NSWE mediasys
predict dv, dev
scatter dv p, mlab(id) mlabsize(vsmall) yline(0)
//scatter dv id1,  yline(0)

//Comparison 
preserve
drop if dv>3.8
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE 
restore

//3// Pregibon leverage
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE 
predict hat, hat
scatter hat p, mlab(id) yline(0)
//scatter hat id1, mlab(id)

//Comparison 
preserve 
drop if hat>0.1
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE 
restore

//INFLUENTIAL OBSERVATIONS COUNTRY LEVEL//
//stepwise exclusion of coutnry cases
logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE if cntryid!=2 

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE  if cntryid!=1 

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE if cntryid!=10 

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE  if cntryid!=7 //ok

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE  if cntryid!=11

//GOOGLE TRENDS//
gen res_exposure=.
gen year=yyyy				
//Bulgaria				
replace res_exposure=	39.3	if year==	2008	& cntryid==2
replace res_exposure=	34.5	if year==	2009	& cntryid==2
replace res_exposure=	35.9	if year==	2010	& cntryid==2
replace res_exposure=	37.0	if year==	2011	& cntryid==2
replace res_exposure=	21.9	if year==	2012	& cntryid==2
replace res_exposure=	37.6	if year==	2013	& cntryid==2
replace res_exposure=	27.3	if year==	2014	& cntryid==2
replace res_exposure=	25.4	if year==	2015	& cntryid==2
replace res_exposure=	17.0	if year==	2016	& cntryid==2
replace res_exposure=	22.4	if year==	2017	& cntryid==2
replace res_exposure=	16.2	if year==	2018	& cntryid==2
				
//Estonia				
replace res_exposure=	3.1	if year==	2008	& cntryid==3
replace res_exposure=	18.1	if year==	2009	& cntryid==3
replace res_exposure=	3.5	if year==	2010	& cntryid==3
replace res_exposure=	15.0	if year==	2011	& cntryid==3
replace res_exposure=	0.9	if year==	2012	& cntryid==3
replace res_exposure=	4.0	if year==	2013	& cntryid==3
replace res_exposure=	5.1	if year==	2014	& cntryid==3
replace res_exposure=	31.7	if year==	2015	& cntryid==3
replace res_exposure=	20.4	if year==	2016	& cntryid==3
replace res_exposure=	27.1	if year==	2017	& cntryid==3
replace res_exposure=	27.2	if year==	2018	& cntryid==3
				
//France				
replace res_exposure=	22.5	if year==	2008	& cntryid==4
replace res_exposure=	21.8	if year==	2009	& cntryid==4
replace res_exposure=	11.2	if year==	2010	& cntryid==4
replace res_exposure=	14.7	if year==	2011	& cntryid==4
replace res_exposure=	22.3	if year==	2012	& cntryid==4
replace res_exposure=	15.8	if year==	2013	& cntryid==4
replace res_exposure=	9.4	if year==	2014	& cntryid==4
replace res_exposure=	11.7	if year==	2015	& cntryid==4
replace res_exposure=	6.6	if year==	2016	& cntryid==4
replace res_exposure=	16.9	if year==	2017	& cntryid==4
replace res_exposure=	17.9	if year==	2018	& cntryid==4
				
//Germany				
replace res_exposure=	29.3	if year==	2008	& cntryid==5
replace res_exposure=	33.6	if year==	2009	& cntryid==5
replace res_exposure=	15.6	if year==	2010	& cntryid==5
replace res_exposure=	28.8	if year==	2011	& cntryid==5
replace res_exposure=	20.9	if year==	2012	& cntryid==5
replace res_exposure=	26.3	if year==	2013	& cntryid==5
replace res_exposure=	17.8	if year==	2014	& cntryid==5
replace res_exposure=	19.4	if year==	2015	& cntryid==5
replace res_exposure=	5.6	if year==	2016	& cntryid==5
replace res_exposure=	2.1	if year==	2017	& cntryid==5
replace res_exposure=	1.8	if year==	2018	& cntryid==5
				
//Greece				
replace res_exposure=	5.9	if year==	2008	& cntryid==6
replace res_exposure=	4.3	if year==	2009	& cntryid==6
replace res_exposure=	1.6	if year==	2010	& cntryid==6
replace res_exposure=	3.3	if year==	2011	& cntryid==6
replace res_exposure=	26.2	if year==	2012	& cntryid==6
replace res_exposure=	18.6	if year==	2013	& cntryid==6
replace res_exposure=	8.0	if year==	2014	& cntryid==6
replace res_exposure=	6.2	if year==	2015	& cntryid==6
replace res_exposure=	3.9	if year==	2016	& cntryid==6
replace res_exposure=	3.9	if year==	2017	& cntryid==6
replace res_exposure=	3.9	if year==	2018	& cntryid==6
					
//Italy				
replace res_exposure=	2.0	if year==	2008	& cntryid==11
replace res_exposure=	5.3	if year==	2009	& cntryid==11
replace res_exposure=	4.1	if year==	2010	& cntryid==11
replace res_exposure=	7.2	if year==	2011	& cntryid==11
replace res_exposure=	9.3	if year==	2012	& cntryid==11
replace res_exposure=	17.2	if year==	2013	& cntryid==11
replace res_exposure=	7.3	if year==	2014	& cntryid==11
replace res_exposure=	9.5	if year==	2015	& cntryid==11
replace res_exposure=	9.2	if year==	2016	& cntryid==11
replace res_exposure=	13.8	if year==	2017	& cntryid==11
replace res_exposure=	27.0	if year==	2018	& cntryid==11
				
//Poland				
replace res_exposure=	1.7	if year==	2008	& cntryid==7
replace res_exposure=	0.9	if year==	2009	& cntryid==7
replace res_exposure=	0.5	if year==	2010	& cntryid==7
replace res_exposure=	0.8	if year==	2011	& cntryid==7
replace res_exposure=	1.5	if year==	2012	& cntryid==7
replace res_exposure=	14.6	if year==	2013	& cntryid==7
replace res_exposure=	28.8	if year==	2014	& cntryid==7
replace res_exposure=	15.3	if year==	2015	& cntryid==7
replace res_exposure=	5.7	if year==	2016	& cntryid==7
replace res_exposure=	2.4	if year==	2017	& cntryid==7
replace res_exposure=	4.9	if year==	2018	& cntryid==7
				
//Slovakia				
replace res_exposure=	2.7	if year==	2008	& cntryid==8
replace res_exposure=	0.7	if year==	2009	& cntryid==8
replace res_exposure=	12.5	if year==	2010	& cntryid==8
replace res_exposure=	3.1	if year==	2011	& cntryid==8
replace res_exposure=	10.7	if year==	2012	& cntryid==8
replace res_exposure=	8.0	if year==	2013	& cntryid==8
replace res_exposure=	5.5	if year==	2014	& cntryid==8
replace res_exposure=	8.2	if year==	2015	& cntryid==8
replace res_exposure=	26.6	if year==	2016	& cntryid==8
replace res_exposure=	47.8	if year==	2017	& cntryid==8
replace res_exposure=	29.2	if year==	2018	& cntryid==8
				
//Sweden				
replace res_exposure=	6.5	if year==	2008	& cntryid==9
replace res_exposure=	8.2	if year==	2009	& cntryid==9
replace res_exposure=	5.1	if year==	2010	& cntryid==9
replace res_exposure=	4.1	if year==	2011	& cntryid==9
replace res_exposure=	5.7	if year==	2012	& cntryid==9
replace res_exposure=	16.2	if year==	2013	& cntryid==9
replace res_exposure=	14.6	if year==	2014	& cntryid==9
replace res_exposure=	9.0	if year==	2015	& cntryid==9
replace res_exposure=	7.2	if year==	2016	& cntryid==9
replace res_exposure=	30.3	if year==	2017	& cntryid==9
replace res_exposure=	21.1	if year==	2018	& cntryid==9
				
//UnitedKingdom				
replace res_exposure=	0.0	if year==	2008	& cntryid==10
replace res_exposure=	19.0	if year==	2009	& cntryid==10
replace res_exposure=	32.3	if year==	2010	& cntryid==10
replace res_exposure=	24.4	if year==	2011	& cntryid==10
replace res_exposure=	11.9	if year==	2012	& cntryid==10
replace res_exposure=	19.7	if year==	2013	& cntryid==10
replace res_exposure=	4.8	if year==	2014	& cntryid==10
replace res_exposure=	25.4	if year==	2015	& cntryid==10
replace res_exposure=	22.9	if year==	2016	& cntryid==10
replace res_exposure=	17.1	if year==	2017	& cntryid==10
replace res_exposure=	9.3	if year==	2018	& cntryid==10

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE  res_exposure 

logit mediahit1 MP orgage C_yyyy electionyear voterrpp miginflow migmip refugees mobfreq6 i.actortype immigration europe lawandorder civilrights economy scope i.repertoire3 i.ctrmob i.NSWE 


///UNPACKING VERBAL/PHYISICAL COUNTERMOBILISATION///
gen verbal=0
 replace verbal=1 if ctrmob1==1
 
logit mediahit1 actortype MP immigration europe economy lawandorder civilrights size i.repertoire3 i.ctrmob verbal orgage C_yyyy electionyear voterrpp miginflow refugees migmip mobfreq6 i.mediasyst, or

///use POLDEM dataset from www.poldem.eu 
// Share of far-right protests///
gen farright=0
replace farright=1 if issue_xeno==1 | issue_cult_cons==1 | actor_party_right==1

gen left=.
replace left=1 if farright==0
gen pr=1

preserve 
collapse (sum) farright pr, by(year) 
gen rw=.
replace rw=farright/pr*100
twoway line rw year
graph rename aggregate, replace
restore

preserve
keep if farright==1
bysort year: egen meanpart=mean(part_all)
tab meanpart year
restore
